package com.yb.xczx.cloud.content.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration //必须存在
@EnableSwagger2 //必须存在
@ComponentScan(basePackages = {"com.yb.xczx.cloud.content"}) //必须存在 扫描的API Controller package name 也能够直接扫描class (basePackageClasses)
public class SwaggerConfig{
    @Bean
    public Docket customDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo());
    }

    private ApiInfo apiInfo() {
        Contact contact = new Contact("姚兵", "http://www.cnblogs.com/getupmorning/", "3221083446@qq.com");
        return new ApiInfoBuilder()
                .title("内容管理服务")
                .description("内容管理服务API接口文档")
                .contact(contact)
                .version("1.1.0")
                .build();
    }
}